package gui;

import interfaces.ClienteInterface;
import interfaces.ServerInterface;
import interfaces.ProdutoInterface;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.TreeMap;
import java.util.TreeSet;

public class Principal {
	/**
	 * @param args
	 */
	public static TreeMap<ProdutoInterface, Integer> itensCarrinho;
	public static TreeSet<ProdutoInterface> resultadosBusca;
	public static Janela janela;
	public static String[] tabsTitle;
	public static TabManager tabManager;
	public static ClienteInterface cliente;

	public static ServerInterface servidor;

	static {
		tabManager = new TabManager();
		cliente = null;
		servidor = null;
	}

	public static void main(String[] args) {
		Registry registry;
		while (servidor == null) {
			try {
				registry = LocateRegistry.getRegistry("192.168.1.131");
				servidor = (ServerInterface) registry.lookup("Servidor");
			} catch (RemoteException e) { // TODO Auto-generated catch block
				System.out.println("Erro ao conectar.");
			} catch (NotBoundException e) { // TODO Auto-generated catch block
				System.out.println("Erro ao pegar o servidor");
			}
		}

		janela = new Janela();
	}

}